package hczc.longcai.com.hccrowdfunding.home.fourth_mine.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.activity.BaseActivity;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;

public class ScoreActivity extends BaseActivity implements View.OnClickListener {

    private static String text[];
    private static String numbers[];
    private LinearLayout linearLayout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_score);

        initDatas();
        initViews();
    }

    private void initDatas() {
        text = new String[]{"注册（每人限一次）","支持成功（即下单成功）","打开APP（每人限一次）"};
        numbers = new String[]{"50","50","50"};
    }

    private void initViews() {
        findViewById(R.id.head_back).setOnClickListener(this);
        ((TextView) findViewById(R.id.head_title)).setText("积分");
        linearLayout = ((LinearLayout) findViewById(R.id.mine_score_details));
        for(int i = 0; i < text.length; i++)
        initDetails(i);
    }

    private void initDetails(int i) {
        View view = LayoutInflater.from(this).inflate(R.layout.score_details, null);
        BaseApplication.scaleScreenHelper.loadView(((ViewGroup) view));
        TextView title = (TextView) view.findViewById(R.id.mine_score_details_title);
        TextView number = (TextView) view.findViewById(R.id.mine_score_details_number);
        title.setText(text[i]);
        number.setText(numbers[i]);
        linearLayout.addView(view);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id){
            case R.id.head_back:
                finish();
                break;
        }
    }
}
